﻿#pragma once

#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE
#include"spdlog/spdlog.h"


namespace ArsEngine {
    class ArsLog {
    public:
        ArsLog() = delete;
        ArsLog(const ArsLog&) = delete;
        ArsLog& operator=(const ArsLog&) = delete;
        static void Init();

        static spdlog::logger* GetCoreLogger() {
            return m_CoreLogger.get();
        }
        static spdlog::logger* GetClientLogger() {
            return m_ClientLogger.get();
        }

    private:
        static std::shared_ptr<spdlog::logger> m_CoreLogger;
        static std::shared_ptr<spdlog::logger> m_ClientLogger;
    };
}
//core log macros
#define AN_CORE_TRACE(...)\
    ::ArsEngine::ArsLog::GetCoreLogger()->trace(__VA_ARGS__);    
#define AN_CORE_INFO(...)\
    ::ArsEngine::ArsLog::GetCoreLogger()->info(__VA_ARGS__);     //(...)表示宏函数可以接受任意个参数
#define AN_CORE_WARN(...)\
    ::ArsEngine::ArsLog::GetCoreLogger()->warn(__VA_ARGS__);     //__VA_ARGS__是一个预定义的宏（前后的双下划线表示这是一个预定义的），可以用来动态的接收的未知个参数。
#define AN_CORE_ERROR(...)\
    ::ArsEngine::ArsLog::GetCoreLogger()->error(__VA_ARGS__);
#define AN_CORE_CRITICAL(...)\
    ::ArsEngine::ArsLog::GetCoreLogger()->critical(__VA_ARGS__);

//client log macros
#define AN_TRACE(...)\
    ::ArsEngine::ArsLog::GetClientLogger()->trace(__VA_ARGS__);
#define AN_INFO(...)\
    ::ArsEngine::ArsLog::GetClientLogger()->info(__VA_ARGS__);
#define AN_WARN(...)\
    ::ArsEngine::ArsLog::GetClientLogger()->warn(__VA_ARGS__);
#define AN_ERROR(...)\
    ::ArsEngine::ArsLog::GetClientLogger()->error(__VA_ARGS__);
#define AN_CRITICAL(...)\
    ::ArsEngine::ArsLog::GetClientLogger()->critical(__VA_ARGS__);
